<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <script type="text/javascript" src="/Fonafe-Bienes/js/jquery.min.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsindex.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsvalidaciones.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/paginacion/jquery.pagination.js"></script>
    <link href="/Fonafe-Bienes/css/default.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/Fonafe-Bienes/css/paginacion/pagination.css" />

    <script type="text/javascript">
        var items_per_page = 15;
        <s:set name="items_per_tabla" value="15" />
            (function($) {

                $(document).ready(function(){
                    initPagination();
                });

                function pageselectCallback(page_index, jq){
                    $('#Searchresult').empty();
                    var num_entries = $('#hiddenresult div.result').length;
                    var max_elem = Math.min((page_index+1) * items_per_page, num_entries);

                    for(var i=page_index*items_per_page;i<max_elem;i++) {
                        var new_content = $('#hiddenresult div.result:eq('+i+')').clone();
                        $('#Searchresult').append(new_content);
                    }
                    return false;
                }

                function initPagination() {
                    var num_entries = $('#hiddenresult div.result').length;
                    $("#Pagination").paginationList(num_entries, {
                        callback: pageselectCallback,
                        items_per_page: items_per_page,
                        num_display_entries: 4,
                        num_edge_entries: 2,
                        prev_text: '<<',
                        next_text: '>>'
                    });
                }

            })(jQuery);
    </script>
</head>
    <body> 
         <div id="header">  
         <jsp:include page="/base/header.jsp" flush="false"/>
         <jsp:include page="/base/menu.jsp" >
					<jsp:param name="parametro" value="mueble" />
		</jsp:include>
        </div>
        
        
        <div id="main">

        <div id="cuerpo">
        <!--sub-menu-->
        <s:form name="formMuebleFinal" action="buscaMuebles" method="post" theme="simple"> 
        
        <div class="slide_menu align_left">
                  
                  <div class="c_busqueda">
                      
                      
                      <div class="titulo_c_busqueda">Buscador de Muebles</div>
                         <div class="cuadro_b_inicial no_border">
                          
                          <div class="bloque">
                              <span>Empresa</span>
                              <s:select label="Empresa" name="busquedaBean.id_empresa" headerKey="0" headerValue="--Todos--"  list="listEmpresa" listKey="id_empresa" listValue="nombre_empresa" theme="simple" />                   
                          </div>
            
                          <div class="bloque">
                          <span>Depart / Provincia / Distrito</span>
                            <div>
                                <input autocomplete="off" id="TxtUbigeo" type="text" onkeyup="$.autocomplete($(this));" value="<s:property value="busquedaBean.ubigeo"/>" class="texto_mediano" name="busquedaBean.ubigeo" size="20px"/>
                            </div>
                          </div>

                          <div class="bloque">
                          <span>Tipo de Mueble</span>
                              <s:select label="Tipo de Mueble" name="busquedaBean.tipMueble" headerKey="0" headerValue="--Todos--"  list="listTipoMueble" listKey="idTipoMueble" listValue="nombre" theme="simple"/>           
                          </div>
                           
                          <div class="area_boton_envio">
                                <a href="javascript:document.formMuebleFinal.submit();" class="isbutton">Buscar</a>                               
                          </div>
                           </div>
                          
                          
                     
                      <ul>
                         
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Tipo de Contrato</a>
                              <div class="sub_menu_sin_hidden no_border">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      
                                      <s:if test="%{tipContrato == 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato" checked="true" value="Venta" class="align_left" onclick="document.formMuebleFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formMuebleFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato == 'Alquiler'}">
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formMuebleFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" checked="true"  class="align_left" onclick="document.formMuebleFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato != 'Alquiler' && tipContrato != 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formMuebleFinal.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formMuebleFinal.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                  </ul>
                                  </div>
                                  
                              </div>
                          </li>
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Precio</a>
                              <div class="sub_menu_sin_hidden">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      <li>
                                           
                                           
                                           <s:if test="%{tipMoneda == 'Sol'}">
                                               <input type="radio" name="tipMoneda" checked="true" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Dolar'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" checked="true"  value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda"  checked="true"  value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                               
                                           <s:if test="%{tipMoneda != 'Sol' && tipMoneda != 'Dolar' && tipMoneda != 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                           
                                           
                                           
                                      </li>
                                      <li>
                                          <span class="align_left span_block">De</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioDesde" name="busquedaBean.precioDesde" value="<s:property value="busquedaBean.precioDesde"/>" onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <span class="align_left span_block">a</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioHasta" name="busquedaBean.precioHasta" value="<s:property value="busquedaBean.precioHasta"/>"  onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      
                            
                                  </ul>
                                  </div>
                                  <div class="area_boton_envio" align="right">
                                        <a href="javascript:document.formMuebleFinal.submit();"><u> Actualizar </u></a>
                                   </div>

                              </div>
                          </li>
                      </ul>
                           </div>
                  </div>         
        </s:form>
        
        <!--listado-->
        
        <div class="slide_content align_rigth">
                     <s:if test="%{mensajeOk != null}">
                        <div class="msg-success" style="width: 330px;">
                            <s:property value="mensajeOk"/>
                        </div>
                    </s:if>
                    <s:if test="%{mensajeFail != null}">
                        <div class="msg-error" style="width: 330px;">
                            <s:property value="mensajeFail"/>
                        </div>
                    </s:if>
                    
            
                  <div class="contenido_grilla">
                      <table cellspacing="0" cellpadding="0" class="tabla_grilla">                          
                              <tbody><tr>
                                  <th class="width_item1"><span class="bg1"></span>Nombre</th>
                                  <th class="width_item2">Descripci&oacute;n</th>
                                  <th class="width_item3">Fecha</th>
                                  <th class="width_item4"><span class="bg2"></span>Precio</th>
                              </tr>
                      </tbody></table>
                      <div id="Searchresult">Cargando...</div>
                      <s:if test="%{listMueble.size() == 0}">
                         <div class="msg-noresult msg-info" style="width: 500px;" align="center">
                          Lo sentimos, no encontramos resultados para tu b&uacute;squeda,<br/>
                          intenta otra b&uacute;squeda, se pueden encontrar muchas cosas.
                          </div>
                      </s:if>
                      <div id="Pagination" style="width:950px "></div>
                      <div id="hiddenresult" style="display:none;">
                      <s:iterator value="listMueble" var="bean">
                      <div class="result">
                      <div class="contenido_items_body">
                          <div class="item_resultado">
                              <div class="img_item width_item1">
                                    <s:url action="detalleMueble" id="detMueble">
                                        <s:param name="idMueble" value="id_mueble"></s:param>
                                    </s:url>
                                  <s:a href="%{detMueble}">
                                    <s:url action="verImagenMueble" id="verImagMueble" />
                                    <img alt="<s:property value="nombre"/>" src="Fonafe-Bienes/struts/verImagenMueble?idFoto=<s:property value="id_mueble"/>" style="max-width: 120px; max-height: 90px;"/> 
                                    
                                  </s:a>
                              </div>
                              <div class="descripcion_item width_item2">
                                  <span class="etiqueta_1" style="text-decoration: underline"><s:a href="%{detMueble}"><s:property value="nombre"/></s:a></span>
                                  <span class="etiqueta_3">
                                      <s:if test="%{descripcion.length() > 100}">
                                        <s:property value="descripcion.substring(0, 100)" escapeCsv="false"/> ...
                                      </s:if>
                                      <s:else>
                                        <s:property value="descripcion" escapeCsv="false"/>
                                      </s:else>
                                        <br/><br/><span style="text-decoration: underline"><s:a class="ver_mas" href="%{detMueble}">Ver m&agrave;s</s:a></span>
                                  </span>
                              </div>
                                        <div class="fecha_item width_item3"><s:property value="fecha_vencimiento" /></div>
                              <div class="precio_item width_item4">
                                    <s:if test="%{tipo_moneda == 'Sol'}">
                                        <s:set name="tipCoin">S/ </s:set>
                                    </s:if>
                                    <s:elseif test="%{tipo_moneda == 'Dolar'}">
                                        <s:set name="tipCoin">US$ </s:set>
                                    </s:elseif>
                                    <s:elseif test="%{tipo_moneda == 'Euro'}">
                                        <s:set name="tipCoin">EUR </s:set>
                                    </s:elseif>
                                    <b><s:property value="tipCoin"/></b>&nbsp;<s:property value="vchPrecio"/>                             
                              </div>
                              <div class="clean_space"></div>
                          </div>
                         </div>
                      </div>
                      </s:iterator>  
                    </div>
                  </div>
         </div>
        
         <div class="clean_space"></div>
        
       </div>

   
    </div>
       <jsp:include page="/base/footer.jsp" flush="false" />        
    </body>
</html>

